package AMainFrame;

import org.eclipse.swt.SWT;  
import org.eclipse.swt.events.MouseAdapter;  
import org.eclipse.swt.events.MouseEvent;  
import org.eclipse.swt.events.SelectionAdapter;  
import org.eclipse.swt.events.SelectionEvent;  
import org.eclipse.swt.graphics.Point;  
import org.eclipse.swt.layout.FillLayout;  
import org.eclipse.swt.widgets.Composite;  
import org.eclipse.swt.widgets.Control;  
import org.eclipse.swt.widgets.Tree;  

import AMainFrame.PeiZhiLiuCheng;
import HardwareConfiguration.HardwareConfiguration_1;
import HardwareConfiguration.HardwareConfiguration_1_1;
import HardwareConfiguration.HardwareConfiguration_1_2;
import HardwareConfiguration.HardwareConfiguration_1_3;
import HardwareConfiguration.HardwareConfiguration_2;
import HardwareConfiguration.HardwareConfiguration_2_A1;
import HardwareConfiguration.HardwareConfiguration_2_A2;
import HardwareConfiguration.HardwareConfiguration_2_B1;
import HardwareConfiguration.HardwareConfiguration_2_B2;
import HardwareConfiguration.HardwareConfiguration_3;
import HardwareConfiguration.HardwareConfiguration_3_1;
import HardwareConfiguration.HardwareConfiguration_3_2;
import HardwareConfiguration.HardwareConfiguration_3_3;
import NetworkConfiguration.NInBestConfiguration_InExample;
import NetworkConfiguration.NInBestConfiguration_ShowBestInCoordinate;
import NetworkConfiguration.NInBestConfiguration_ShowBestInPlane;
import NetworkConfiguration.NInHSConfiguration_1_Hardware;
import NetworkConfiguration.NInHSConfiguration_1_ShowHS;
import NetworkConfiguration.NInHSConfiguration_1_Software;
import NetworkConfiguration.NInHSConfiguration_2_HardworkHardware;
import NetworkConfiguration.NInHSConfiguration_2_HardworkSoftware;
import NetworkConfiguration.NInHSConfiguration_2_ShowHardworkHS;
import NetworkConfiguration.NSetExampleMessage_BaseParameter;
import NetworkConfiguration.NSetExampleMessage_DataDesign;
import NetworkConfiguration.NSetExampleMessage_PortYS;
import NetworkConfiguration.NSetExampleMessage_ResourceYS;
import NetworkConfiguration.NSetExampleMessage_SeparationYS;
import NetworkConfiguration.NetworkConfiguration_1_SetExampleMessage;
import NetworkConfiguration.NetworkConfiguration_2_InHSConfiguration;
import NetworkConfiguration.NetworkConfiguration_3_InBestConfiguration;
import SoftwareConfiguration.SInBestConfiguration_InExample;
import SoftwareConfiguration.SInBestConfiguration_ShowBestInCoordinate;
import SoftwareConfiguration.SInBestConfiguration_ShowBestInPlane;
import SoftwareConfiguration.SInHSConfiguration_1_Hardware;
import SoftwareConfiguration.SInHSConfiguration_1_ShowHardware;
import SoftwareConfiguration.SInHSConfiguration_2_HardworkHardware;
import SoftwareConfiguration.SInHSConfiguration_2_ShowHardworkH;
import SoftwareConfiguration.SetExampleMessage_DengshiYS;
import SoftwareConfiguration.SetExampleMessage_ResourceYS;
import SoftwareConfiguration.SetExampleMessage_SeparationYS;
import SoftwareConfiguration.SetExampleMessage_YuanziYS;
import SoftwareConfiguration.SoftwareConfiguration_1_SetExampleMessage;
import SoftwareConfiguration.SoftwareConfiguration_2_InHSConfiguration;
import SoftwareConfiguration.SoftwareConfiguration_3_InBestConfiguration;

import org.eclipse.swt.widgets.TreeItem;  
    /** 
     * @author huangfox 
     * 左面板 
     * 一般可以作成功能节点树 
     */  
    public class LeftCom extends Composite {  
        private Tree tree;  
        /** 
         * Create the composite 
         * @param parent 
         * @param style 
         */  
        public LeftCom(Composite parent, int style) {  
            super(parent, style);  
            this.setLayout(new FillLayout());  
              
            //定义一颗功能树  
            tree = new Tree(this, SWT.BORDER);  
              
            //简单构造  
            
            TreeItem si = new TreeItem(tree, SWT.NONE);  
            si.setText("配置流程");  
            
            TreeItem qi = new TreeItem(tree, SWT.NONE);  
            qi.setText("主界面");  
            
            TreeItem ri = new TreeItem(tree, SWT.NONE);  
            ri.setText("配置方案");  
            
            TreeItem ti = new TreeItem(ri, SWT.NONE);  
            ti.setText("1-硬件配置");  
            TreeItem ti_1 = new TreeItem(ti, SWT.NONE);  
            ti_1.setText("硬件分配-设置实例信息");
            TreeItem ti_1_1 = new TreeItem(ti_1, SWT.NONE);
            ti_1_1.setText("硬件配置实例-资源约束");  
            TreeItem ti_1_2 = new TreeItem(ti_1, SWT.NONE);
            ti_1_2.setText("硬件配置实例-隔离约束");  
            TreeItem ti_1_3 = new TreeItem(ti_1, SWT.NONE);
            ti_1_3.setText("硬件配置实例-等式约束");  


            TreeItem ti_2 = new TreeItem(ti, SWT.NONE);  
            ti_2.setText("硬件配置-导入软件配置"); 
            TreeItem ti_2_1 = new TreeItem(ti_2, SWT.NONE);
            ti_2_1.setText("硬件配置-解文件导入1");  
            TreeItem ti_2_2 = new TreeItem(ti_2, SWT.NONE);
            ti_2_2.setText("硬件配置-解文件导入2");  
            TreeItem ti_2_3 = new TreeItem(ti_2, SWT.NONE);
            ti_2_3.setText("硬件配置-图形界面手工进行配置1");
            TreeItem ti_2_4 = new TreeItem(ti_2, SWT.NONE);
            ti_2_4.setText("硬件配置-图形界面手工进行配置2");
            
            TreeItem ti_3 = new TreeItem(ti, SWT.NONE);  
            ti_3.setText("硬件配置-导入优化配置");
            TreeItem ti_3_1 = new TreeItem(ti_3, SWT.NONE);
            ti_3_1.setText("硬件配置实例导入");  
            TreeItem ti_3_2 = new TreeItem(ti_3, SWT.NONE);
            ti_3_2.setText("硬件配置显示");  
            TreeItem ti_3_3 = new TreeItem(ti_3, SWT.NONE);
            ti_3_3.setText("硬件配置界面显示");
            
            
            
            
            
            
            TreeItem ti1 = new TreeItem(ri, SWT.NONE);  
            ti1.setText("2-软件配置"); 
            TreeItem ti1_1 = new TreeItem(ti1, SWT.NONE);
            ti1_1.setText("软件配置-设置实例信息");
            TreeItem ti1_1_1 = new TreeItem(ti1_1, SWT.NONE);
            ti1_1_1.setText("软件配置实例-资源约束");  
            TreeItem ti1_1_2 = new TreeItem(ti1_1, SWT.NONE);
            ti1_1_2.setText("软件配置实例-隔离约束");  
            TreeItem ti1_1_3 = new TreeItem(ti1_1, SWT.NONE);
            ti1_1_3.setText("软件配置实例-原子约束");  
            TreeItem ti1_1_4 = new TreeItem(ti1_1, SWT.NONE);
            ti1_1_4.setText("软件配置实例-等式约束"); 
            
            TreeItem ti1_2 = new TreeItem(ti1, SWT.NONE);
            ti1_2.setText("软件配置-导入硬件配置");
            TreeItem ti1_2_1 = new TreeItem(ti1_2, SWT.NONE);
            ti1_2_1.setText("软件配置-解文件导入1");  
            TreeItem ti1_2_2 = new TreeItem(ti1_2, SWT.NONE);
            ti1_2_2.setText("软件配置-解文件导入2");  
            TreeItem ti1_2_3 = new TreeItem(ti1_2, SWT.NONE);
            ti1_2_3.setText("软件配置-图形界面手工进行配置1");
            TreeItem ti1_2_4 = new TreeItem(ti1_2, SWT.NONE);
            ti1_2_4.setText("软件配置-图形界面手工进行配置2"); 
            
            TreeItem ti1_3 = new TreeItem(ti1, SWT.NONE);
            ti1_3.setText("软件配置-导入优化配置"); 
            TreeItem ti1_3_1 = new TreeItem(ti1_3, SWT.NONE);
            ti1_3_1.setText("软件配置实例导入");  
            TreeItem ti1_3_2 = new TreeItem(ti1_3, SWT.NONE);
            ti1_3_2.setText("软件配置显示");  
            TreeItem ti1_3_3 = new TreeItem(ti1_3, SWT.NONE);
            ti1_3_3.setText("软件配置界面显示");
            
            
            
            
            
            TreeItem ti2= new TreeItem(ri, SWT.NONE);  
            ti2.setText("3-网络配置"); 
            TreeItem ti2_1 = new TreeItem(ti2, SWT.NONE);
            ti2_1.setText("网络配置-设置实例信息");
            TreeItem ti2_1_1 = new TreeItem(ti2_1, SWT.NONE);
            ti2_1_1.setText("网络配置:基本数据结构定义");  
            TreeItem ti2_1_2 = new TreeItem(ti2_1, SWT.NONE);
            ti2_1_2.setText("网络配置:飞机实例基本参数设置");  
            TreeItem ti2_1_3 = new TreeItem(ti2_1, SWT.NONE);
            ti2_1_3.setText("网络配置-资源约束");  
            TreeItem ti2_1_4 = new TreeItem(ti2_1, SWT.NONE);
            ti2_1_4.setText("网络设备-端口约束");  
            TreeItem ti2_1_5 = new TreeItem(ti2_1, SWT.NONE);
            ti2_1_5.setText("网络安全约束-隔离约束");  
             
            TreeItem ti2_2 = new TreeItem(ti2, SWT.NONE);
            ti2_2.setText("网络配置-导入软硬件配置");
            TreeItem ti2_2_1 = new TreeItem(ti2_2, SWT.NONE);
            ti2_2_1.setText("网络配置-软件文件导入");  
            TreeItem ti2_2_2 = new TreeItem(ti2_2, SWT.NONE);
            ti2_2_2.setText("网络配置-硬件文件导入");  
            TreeItem ti2_2_3 = new TreeItem(ti2_2, SWT.NONE);
            ti2_2_3.setText("网络配置-软硬件配置显示");  
            TreeItem ti2_2_4 = new TreeItem(ti2_2, SWT.NONE);
            ti2_2_4.setText("网络配置-硬件手工配置"); 
            TreeItem ti2_2_5 = new TreeItem(ti2_2, SWT.NONE);
            ti2_2_5.setText("网络配置-软件手工配置"); 
            TreeItem ti2_2_6 = new TreeItem(ti2_2, SWT.NONE);
            ti2_2_6.setText("网络配置-手工配置显示"); 
             
            TreeItem ti2_3 = new TreeItem(ti2, SWT.NONE);
            ti2_3.setText("网络配置-导入优化配置"); 
            TreeItem ti2_3_1 = new TreeItem(ti2_3, SWT.NONE);
            ti2_3_1.setText("网络配置实例导入");  
            TreeItem ti2_3_2 = new TreeItem(ti2_3, SWT.NONE);
            ti2_3_2.setText("网络优化显示");  
            TreeItem ti2_3_3 = new TreeItem(ti2_3, SWT.NONE);
            ti2_3_3.setText("网络配置界面显示"); 
            
            
            
            TreeItem pi = new TreeItem(tree, SWT.NONE);  
            pi.setText("提示框");  
            
            
            
            
            //默认展开，要在添加完子节点后设置，否则失效。 
            ri.setExpanded(true);  
            ti.setExpanded(true);
            ti_1.setExpanded(true);  
            ti_2.setExpanded(true);
            ti_3.setExpanded(true);
            
            ti1.setExpanded(true);
            ti1_1.setExpanded(true);  
            ti1_2.setExpanded(true);
            ti1_3.setExpanded(true);
            
            ti2.setExpanded(true);
            ti2_1.setExpanded(true);  
            ti2_2.setExpanded(true);
            ti2_3.setExpanded(true);
            
            
              
            //点击功能树，控制右面板的展示  
            tree.addSelectionListener(new SelectionAdapter() {  
                @Override  
                public void widgetSelected(SelectionEvent e) {  
                    //获得点击的功能节点（treeItem）  
                    TreeItem selectedTI = (TreeItem) e.item;  
                    //获得右面板  
                    RightCom right = MainApp.right;  
                    //销毁之前面板的内容  
                    Control[] rightCs = right.getChildren(); 
                    
                    for (int i = 0; i < rightCs.length; i++) {  
                        rightCs[i].dispose();  
                    }  
                    //根据点击的功能节点展示右面板  
                    String selStr = selectedTI.getText();  
                    System.out.println(selStr);  
                    
                    //硬件配置子条目
                    if(selStr.equalsIgnoreCase("硬件配置实例-资源约束"))
                    {  
                        //新建右面板上的内容，其实也是一个面板（RightComA）！  
                    	HardwareConfiguration_1_1 comA = new HardwareConfiguration_1_1(right, SWT.NONE);  
                        right.layout();  
                    }
                    else if(selStr.equalsIgnoreCase("硬件配置实例-隔离约束")){  
                    	HardwareConfiguration_1_2 comB = new HardwareConfiguration_1_2(right, SWT.NONE);  
                        right.layout();  
                    }
                    else if(selStr.equalsIgnoreCase("硬件配置实例-等式约束")){  
                    	HardwareConfiguration_1_3 comC = new HardwareConfiguration_1_3(right, SWT.NONE);  
                        right.layout();  
                    }
                    else if(selStr.equalsIgnoreCase("配置流程")){  
                    	PeiZhiLiuCheng comD = new PeiZhiLiuCheng(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("配置方案")){  
                    	FangAnXuanZe comE= new FangAnXuanZe(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("硬件分配-设置实例信息")){  
                    	HardwareConfiguration_1 comF= new HardwareConfiguration_1(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("硬件配置-导入软件配置")){  
                    	HardwareConfiguration_2 comG= new HardwareConfiguration_2(right, SWT.NONE);  
                        right.layout();  
                    }                     
                    else if(selStr.equalsIgnoreCase("硬件配置-导入优化配置")){  
                    	HardwareConfiguration_3 comG= new HardwareConfiguration_3(right, SWT.NONE);  
                        right.layout();  
                    }                     
                    else if(selStr.equalsIgnoreCase("硬件配置-解文件导入1")){  
                    	HardwareConfiguration_2_A1 comH= new HardwareConfiguration_2_A1(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("硬件配置-解文件导入2")){  
                    	HardwareConfiguration_2_A2 comI= new HardwareConfiguration_2_A2(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("硬件配置-图形界面手工进行配置1")){  
                    	HardwareConfiguration_2_B1 comJ= new HardwareConfiguration_2_B1(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("硬件配置-图形界面手工进行配置2")){  
                    	HardwareConfiguration_2_B2 comK= new HardwareConfiguration_2_B2(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("硬件配置实例导入")){  
                    	HardwareConfiguration_3_1 comL= new HardwareConfiguration_3_1(right, SWT.NONE);  
                        right.layout();  
                    }
                    else if(selStr.equalsIgnoreCase("硬件配置显示")){  
                    	HardwareConfiguration_3_2 comM= new HardwareConfiguration_3_2(right, SWT.NONE);  
                        right.layout();  
                    }
                    else if(selStr.equalsIgnoreCase("硬件配置界面显示")){  
                    	HardwareConfiguration_3_3 comN= new HardwareConfiguration_3_3(right, SWT.NONE);  
                        right.layout();  
                    }
                    
                    
                    //软件配置子条目
                    else if(selStr.equalsIgnoreCase("软件配置-设置实例信息")){  
                    	SoftwareConfiguration_1_SetExampleMessage comO= new SoftwareConfiguration_1_SetExampleMessage(right, SWT.NONE);  
                        right.layout();  
                    }
                    else if(selStr.equalsIgnoreCase("软件配置实例-隔离约束")){  
                    	SetExampleMessage_SeparationYS comFF = new SetExampleMessage_SeparationYS(right, SWT.NONE);  
                        right.layout();  
                    }
                    else if(selStr.equalsIgnoreCase("软件配置实例-资源约束")){  
                    	SetExampleMessage_ResourceYS comGG = new SetExampleMessage_ResourceYS(right, SWT.NONE);  
                        right.layout();  
                    }
                    else if(selStr.equalsIgnoreCase("软件配置实例-原子约束")){  
                    	SetExampleMessage_YuanziYS comHH = new SetExampleMessage_YuanziYS(right, SWT.NONE);  
                        right.layout();  
                    }
                    else if(selStr.equalsIgnoreCase("软件配置实例-等式约束")){  
                    	SetExampleMessage_DengshiYS comII = new SetExampleMessage_DengshiYS(right, SWT.NONE);  
                        right.layout();  
                    }
                    
                    
                    else if(selStr.equalsIgnoreCase("软件配置-导入硬件配置")){  
                    	SoftwareConfiguration_2_InHSConfiguration comP= new SoftwareConfiguration_2_InHSConfiguration(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("软件配置-导入优化配置")){  
                    	SoftwareConfiguration_3_InBestConfiguration comQ= new SoftwareConfiguration_3_InBestConfiguration(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("软件配置-解文件导入1")){  
                    	SInHSConfiguration_1_Hardware comR= new SInHSConfiguration_1_Hardware(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("软件配置-解文件导入2")){  
                    	SInHSConfiguration_1_ShowHardware comR= new SInHSConfiguration_1_ShowHardware(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("软件配置-图形界面手工进行配置1")){  
                    	SInHSConfiguration_2_HardworkHardware comR= new SInHSConfiguration_2_HardworkHardware(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("软件配置-图形界面手工进行配置2")){  
                    	SInHSConfiguration_2_ShowHardworkH comR= new SInHSConfiguration_2_ShowHardworkH(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("软件配置实例导入")){  
                    	SInBestConfiguration_InExample comR= new SInBestConfiguration_InExample(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("软件配置显示")){  
                    	SInBestConfiguration_ShowBestInCoordinate comR= new SInBestConfiguration_ShowBestInCoordinate(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("软件配置界面显示")){  
                    	SInBestConfiguration_ShowBestInPlane comR= new SInBestConfiguration_ShowBestInPlane(right, SWT.NONE);  
                        right.layout();  
                    } 
                    
                    
                    
                    //网络配置子条目
                    
                    else if(selStr.equalsIgnoreCase("网络配置-设置实例信息")){  
                    	NetworkConfiguration_1_SetExampleMessage comAAA= new NetworkConfiguration_1_SetExampleMessage(right, SWT.NONE);  
                        right.layout();  
                    }
                    else if(selStr.equalsIgnoreCase("网络配置-导入软硬件配置")){  
                    	NetworkConfiguration_2_InHSConfiguration comBB= new NetworkConfiguration_2_InHSConfiguration(right, SWT.NONE);  
                        right.layout();  
                    }     
                    else if(selStr.equalsIgnoreCase("网络配置-导入优化配置")){  
                    	NetworkConfiguration_3_InBestConfiguration comCC= new NetworkConfiguration_3_InBestConfiguration(right, SWT.NONE);  
                        right.layout();  
                    }
                    
                    
                    
                    else if(selStr.equalsIgnoreCase("网络配置:基本数据结构定义")){  
                    	NSetExampleMessage_BaseParameter comSS= new NSetExampleMessage_BaseParameter(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("网络配置:飞机实例基本参数设置")){  
                    	NSetExampleMessage_DataDesign  comTT= new NSetExampleMessage_DataDesign (right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("网络配置-资源约束")){  
                    	NSetExampleMessage_ResourceYS comVV= new NSetExampleMessage_ResourceYS(right, SWT.NONE);  
                        right.layout();  
                    } 

                    else if(selStr.equalsIgnoreCase("网络设备-端口约束")){  
                    	NSetExampleMessage_PortYS comUU= new NSetExampleMessage_PortYS(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("网络安全约束-隔离约束")){  
                    	NSetExampleMessage_SeparationYS comWW= new NSetExampleMessage_SeparationYS(right, SWT.NONE);  
                        right.layout();  
                    } 


                    
                    else if(selStr.equalsIgnoreCase("网络配置-软件文件导入")){  
                    	NInHSConfiguration_1_Software comS= new NInHSConfiguration_1_Software(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("网络配置-硬件文件导入")){  
                    	NInHSConfiguration_1_Hardware comT= new NInHSConfiguration_1_Hardware(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("网络配置-软硬件配置显示")){  
                    	NInHSConfiguration_1_ShowHS comU= new NInHSConfiguration_1_ShowHS(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("网络配置-硬件手工配置")){  
                    	NInHSConfiguration_2_HardworkHardware comV= new NInHSConfiguration_2_HardworkHardware(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("网络配置-软件手工配置")){  
                    	NInHSConfiguration_2_HardworkSoftware comW= new NInHSConfiguration_2_HardworkSoftware(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("网络配置-手工配置显示")){  
                    	NInHSConfiguration_2_ShowHardworkHS comX= new NInHSConfiguration_2_ShowHardworkHS(right, SWT.NONE);  
                        right.layout();  
                    } 
                    
                    
                    else if(selStr.equalsIgnoreCase("网络配置实例导入")){  
                    	NInBestConfiguration_InExample comDD= new NInBestConfiguration_InExample(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("网络优化显示")){  
                    	NInBestConfiguration_ShowBestInCoordinate comEE= new NInBestConfiguration_ShowBestInCoordinate(right, SWT.NONE);  
                        right.layout();  
                    } 
                    else if(selStr.equalsIgnoreCase("网络配置界面显示")){  
                    	NInBestConfiguration_ShowBestInPlane comFF= new NInBestConfiguration_ShowBestInPlane(right, SWT.NONE);  
                        right.layout();  
                    } 
                    
                    
                    
                    
                    
                    

                }  
            });  
              
              
        }  
        @Override  
        protected void checkSubclass() {  
            // Disable the check that prevents subclassing of SWT components  
        }  
    }  